package from;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.form.RadioChoice;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RadioPage extends WebPage {
    private static List SITES = new ArrayList();
    private static Map NAMES = new HashMap();

    static {
        SITES.add("http://aa.com");
        SITES.add("http://bb.com");
        SITES.add("http://cc.com");

        NAMES.put("http://aa.com", "aa");
        NAMES.put("http://bb.com", "bb");
        NAMES.put("http://cc.com", "cc");
    }

    public RadioPage(){
        super();
        Form form = new Form("formR1");
        add(form);

        IChoiceRenderer renderer = new ChoiceRenderer(){
            public Object getDisplayValue(Object object){
                return NAMES.get(object);
            }
        };

        RadioChoice siteChoice = new RadioChoice("sites",SITES,renderer);
        form.add(siteChoice);
    }
}
